#!/usr/bin/env python
# -*- coding: utf-8 -*-
#coding=utf8

# 本文件由自动工具 proto.py 自动生成，请勿修改
# filename msg1000_csbuf.py
# package ptl

from ptl.base_csbuf import *


# message Err
class Err:
	def __init__(self):
		self.protoid = 1
		self.err = 0
		self.msg = ""
		self.proto = 0

	def Marshal(writer):
		writer.setUint16(self.err, 1)
		writer.setString(self.msg, 2)
		writer.setUint16(self.proto, 3)

	def Unmarshal( reader):
		self.err = reader.getUint16(1)
		self.msg = reader.getString(2)
		self.proto = reader.getUint16(3)
# message Ping
class Ping:
	def __init__(self):
		self.protoid = 3
		self.ping = 0

	def Marshal(writer):
		writer.setUint32(self.ping, 1)

	def Unmarshal( reader):
		self.ping = reader.getUint32(1)
# message Pong
class Pong:
	def __init__(self):
		self.protoid = 3
		self.ping = 0
		self.svr_time = 0

	def Marshal(writer):
		writer.setUint32(self.ping, 1)
		writer.setUint32(self.svr_time, 2)

	def Unmarshal( reader):
		self.ping = reader.getUint32(1)
		self.svr_time = reader.getUint32(2)
# message Resp4
class Resp4:
	def __init__(self):
		self.protoid = 4
		self.svr_time = 0
		self.code = 0
		self.msg = ""

	def Marshal(writer):
		writer.setUint32(self.svr_time, 1)
		writer.setUint32(self.code, 2)
		writer.setString(self.msg, 3)

	def Unmarshal( reader):
		self.svr_time = reader.getUint32(1)
		self.code = reader.getUint32(2)
		self.msg = reader.getString(3)
# message Req5
class Req5:
	def __init__(self):
		self.protoid = 5
		self.op = 0
		self.key = ""
		self.value = ""

	def Marshal(writer):
		writer.setUint8(self.op, 1)
		writer.setString(self.key, 2)
		writer.setString(self.value, 3)

	def Unmarshal( reader):
		self.op = reader.getUint8(1)
		self.key = reader.getString(2)
		self.value = reader.getString(3)
# message Resp5
class Resp5:
	def __init__(self):
		self.protoid = 5
		self.status = 0
		self.list = []

	def Marshal(writer):
		writer.setUint8(self.status, 1)
		countlist = len(self.list)
		writer.setArray(countlist, 2)
		for i in range(countlist):
			writer.setMessage(0)
			self.list[i].Marshal(writer)
			writer.endSetMessage()

	def Unmarshal( reader):
		self.status = reader.getUint8(1)
		for i in range(reader.getArray(2)):
			msg = SimpleData() 
			reader.getMessage(0)
			msg.Unmarshal(reader)
			reader.endGetMessage()
			self.list.append(msg)
